import java.util.*;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
/*        Integer[] a = {10,4,2,6,56,2};

        Arrays.sort(a,(o1, o2) -> o2-o1);
        System.out.println(Arrays.toString(a));*/

        HashMap<Integer,Integer> a1 = new HashMap<>();
        a1.put(2,2);
        a1.put(1,1879);
        a1.put(33,3);
        a1.put(5,5);
        a1.put(26,6);
        a1.put(79,7);
        a1.put(4,4789);
        a1.forEach((k,v)->System.out.print(k+" "+v + "    "));
        System.out.println();
        System.out.println("----------------------");
        List<Map.Entry<Integer, Integer>> collect = a1.entrySet().stream().sorted((Map.Entry<Integer, Integer> o1, Map.Entry<Integer, Integer> o2) -> o1.getKey() - o2.getKey())
                .collect(Collectors.toList());
        collect.forEach(System.out::println);


    }
}